---
title: ProcessOB3PRetention architecture
summary: Layers, components, composition root, and design constraints of the ProcessOB3PRetention console application.
status: draft
owner: Documents
last_reviewed: 2026-10-06
---

# ProcessOB3PRetention architecture

ProcessOB3PRetention is a thin console application hosted by the `SAIF.Framework.Windows` runner. The framework owns argument parsing, dependency-injection container construction, lifecycle sequencing, and exit codes; the application contributes an argument container, one orchestrating class, and two service wrappers.

## Architecture diagram

The diagram shows how the framework runner builds the container, resolves the application class, and reaches the two external systems through the service wrappers.

```mermaid
flowchart TD
    Sched["Scheduler (Automic)"] --> Main["Program.Main"]
    Main --> Runner["SaifStandardProgramBase.Run"]
    Runner --> Args["ArgContainer: Day, Month, Year"]
    Runner --> Container["Autofac container"]
    Container --> App["ThirdPartyRetentionProcessor"]
    App --> Img["ImagingApiClient"]
    App --> Ob["OnBaseService"]
    App --> Log["IConsoleLogService"]
    App --> Env["IEnvironmentService"]
    Img --> Json["JsonHttpClient"]
    Json --> ImgApi["Imaging REST API"]
    Ob --> Wcf["HylandOutBoundContractClient"]
    Wcf --> OnBase["OnBase archival SOAP service"]
    Env --> EnvApi["Environment API"]
```

## Components

| Component | Type | Responsibility |
| --- | --- | --- |
| `Program` | Runner (`SaifStandardProgramBase<ConsoleBase<ArgContainer>, ArgContainer>`) | Entry point and composition root; registers application services |
| `ArgContainer` | `StandardArgumentContainerBase<ArgContainer>` | Declares and parses the optional `Day`, `Month`, `Year` arguments |
| `ThirdPartyRetentionProcessor` | `ConsoleBase<ArgContainer>` | Orchestrates fetch, batch, archive, and mark-processed steps in `Execute` |
| `ImagingApiClient` | `IImagingApiClient` | Wraps `JsonHttpClient` for the Imaging REST API (`GET` claims, `PUT` mark processed) |
| `OnBaseService` | `IOnBaseService` | Wraps the WCF `HylandOutBoundContractClient` to call `ArchiveDocument` |
| `ThirdPartyRetention` | DTO (`Contracts/ThirdPartyRetention.cs`) | Retention record (id, claim number, close date) exchanged with the Imaging API |

## Composition root

`Program.RegisterAppDependencies` performs the following registrations:

1. Configures OpenTelemetry with owner tag `Documents`.
2. Calls `RegisterCommonDependencies(Environment.UserName)`, which registers `WindowsEnvironmentService` as `IEnvironmentService` and `ConsoleLogService` as `IConsoleLogService`, both `InstancePerLifetimeScope`.†
3. Registers `ImagingApiClient` as `IImagingApiClient` with the default lifetime.
4. Registers `OnBaseService` as `IOnBaseService` with the default lifetime.

The application class itself is registered by the inherited `CreateApplication` factory.† No `DatabaseConfig` is supplied; the framework still registers named `IUnitOfWorkFactory` singletons, but nothing in this application resolves them.†

The `ImagingApiClient` and `OnBaseService` constructors read their endpoint URLs from the Environment API when the container resolves them, so a missing `imagingapiurl` or `ProcessOB3PRetention.WSPEndPointUrl` setting fails the run before `Execute` starts. See [Configuration](configuration.md).

## Design constraints

- Single sequential workflow with no concurrency; batches are processed one at a time.
- No transaction boundary exists. Each batch is an OnBase call followed by an Imaging API `PUT`, with no compensation (see [Business rules](business-rules.md)).
- `SAIF.Framework.Data.NHibernate` and `SAIF.HashUtil` are referenced but never used by application code. See [Dependencies](dependencies.md).
- `ApplicationName` is not overridden, so it defaults to `ThirdPartyRetentionProcessor`.*

## Related documentation

| Documentation | Description |
| --- | --- |
| [Index](index.md) | Documentation entry point |
| [Overview](overview.md) | Purpose and capabilities |
| [Run lifecycle](run-lifecycle.md) | Execution flow and exit codes |
| [Arguments](arguments.md) | Argument contract |
| [Configuration](configuration.md) | Settings and environment variables |
| [Dependencies](dependencies.md) | Packages and API dependencies |
| [Operations and processes](operations-processes.md) | Operation catalog |
| [Business rules](business-rules.md) | Rules enforced during processing |
| [Operational runbook](operational-runbook.md) | Run and recovery procedures |
| [Tech debt](tech-debt.md) | Technical debt observations |

> **Note:** Statements marked with `†` are derived from dependency library
> documentation via the Legends CLI. Statements marked with `*` were inferred
> from code structure or contextual evidence.

## Sources

- `ProcessOB3PRetention/Program.cs`
- `ProcessOB3PRetention/ArgContainer.cs`
- `ProcessOB3PRetention/ThirdPartyRetentionProcessor.cs`
- `ProcessOB3PRetention/Services/ImagingApiClient.cs`
- `ProcessOB3PRetention/Services/OnBaseService.cs`
- `ProcessOB3PRetention/Contracts/ThirdPartyRetention.cs`
- `ProcessOB3PRetention/ProcessOB3PRetention.csproj`
